import * as types from '../../../global/constants/ActionTypes';

const initialState = {
  loading: false,
  errorMessage: '',
  isSuccess: false,
  user: null,
  hasLogin: false,
};

export default function loginIn(state = initialState, action) {
  switch (action.type) {
    case types.LOGIN_CHECKING_LOGIN:
    case types.LOGIN_HAS_LOGIN:
    case types.LOGIN_PROCESSING:
    case types.LOGIN_SUCCESS:
    case types.LOGIN_FAIL:
      console.log(action.type, action);
      return {
        ...state,
        ...action
      };
    default:
      return state;
  }
}